package patracuolla.id.projects;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
//This class is to read the files in 
//readDatabase on paper

public class ReadDatabase {

	/**
	 * @param args
	 * @throws IOException
	 */
	public void scanForViruses() throws IOException {

		String line = "";
		String myArray[];
		FileReader fr = new FileReader("C:\\Users\\Student\\Documents\\def.txt");
		BufferedReader br = new BufferedReader(fr);

		// Keeps going until there's nothing left in the file to read
		ScanFiles realsize = new ScanFiles();
		while ((line = br.readLine()) != null) {
			myArray = line.split(",");
			System.out.println(line); 
			String path = myArray[0];
			String size = myArray[1];
			int sizenum = Integer.parseInt(size.trim());
			// After defining path and size take path, call getSize (which
			// passes in a string of the path) returns int (size)
			realsize.getSize(path);
			//^This calls the method getSize from ScanFiles and calculates the current size
			
			if(sizenum != realsize.getSize(path)){
				System.out.println("This file may be corrupted");
				}
		}
		br.close();
	}
}